<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        // json数据主要由{},[]组成
        var stu = {
            'student':[
                {'name':'tina','grade':1,'age':11,'gender':'mail'},
                {'name':'tom','grade':1,'age':12,'gender':'femail'},
                {'name':'john','grade':1,'age':11,'gender':'femail'},
            ],
            'classroom':{'class1':'room1','class2':'room2','class3':'room3'}
        };
        // 读取数据
        // document.write();表示读取到数据并在页面显示出来
        document.write(stu.student[1].name);
        document.write(stu.student[0].age);
        document.write(stu.classroom.class1);
        // 用中括号访问对象值
        document.write(stu['classroom'].class2);

        // delete删除数组，只是删除数组中元素的值，仍会保留空间。不影响数组原有长度，只是将要删除的值置为undefined
    </script>
</body>
</html>